<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <h2>Cadastrando</h2>
            <p:panel  styleClass="container_24 clearfix " style="background: none; border: none;">
                <h:form id="form" acceptcharset="utf-8">
                    <p:growl id="msg" life="3000"/>
                    <p class="subtitle">Dados Gerais</p>

                    <p:outputLabel value="Nome : " styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.notaryOffice.nome}"  styleClass="grid_20"/>

                    <div class="clear"/>

                    <p:outputLabel value="Denominação :" styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.notaryOffice.denominationOffice}"  styleClass="grid_8"/>
                    <p:outputLabel value="Natureza :" styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.notaryOffice.natureOffice}"  styleClass="grid_9"/>

                    <div class="clear"/>

                    <p:outputLabel value="Email :" styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.notaryOffice.email}"  styleClass="grid_20"/>

                    <div class="clear"/>

                    <p class="subtitle">Dados do Titular</p>
                    <p:outputLabel value="Titular :" styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.notaryOffice.titular}" styleClass="grid_20"/>
                    <div class="clear"/>
                    <p:outputLabel value="Cpf :" styleClass="grid_3"/>
                    <p:inputMask value="#{managerCreateNotaryOffice.notaryOffice.cpf}" mask="999.999.999-99" styleClass="grid_8"/>
                    <h:outputLabel value="Ingresso :  " styleClass="grid_3"/>
                    <div class="grid_9">
                        <p:selectOneMenu style="width: 100%"  id="type" 
                                         value="#{managerCreateNotaryOffice.notaryOffice.admission}" >
                            <f:selectItems var="item" itemLabel="#{item.toString()}" itemValue="#{item}"  
                                           value="#{managerCreateNotaryOffice.admission}" />  
                        </p:selectOneMenu>
                    </div>
                    <div class="clear"/>
                    <h:outputLabel value="Data Posse :  " styleClass="grid_3"/>
                    <div class="grid_8">
                        <p:calendar value="#{managerCreateNotaryOffice.notaryOffice.datePossesion}" autocomplete="true"
                                    showOn="button"/>
                    </div>
                    <div class="clear"/>
                    <p class="subtitle">Dados do Endereço</p>

                    <p:outputLabel value="Rua :"  styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.addres.street}"  styleClass="grid_20"/>
                    <div class="clear"/>
                    <p:outputLabel value="Bairro :"  styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.addres.district}"  styleClass="grid_8"/>
                    <p:outputLabel value="Número :"  styleClass="grid_3"/>
                    <p:inputText value="#{managerCreateNotaryOffice.addres.num}"  styleClass="grid_9"/>

                    <div class="clear"/>
                    <p:outputLabel value="CEP :"  styleClass="grid_3"/>
                    <p:inputMask mask="99.999-999" value="#{managerCreateNotaryOffice.addres.cep}"  styleClass="grid_8"/>

                    <p:outputLabel  value=" Cidade: "  styleClass="grid_3" />
                    <div class="grid_9">
                        <p:autoComplete id="cidadeEstado" value="#{managerCreateNotaryOffice.addres.city}" completeMethod="#{managerCreateAddress.completeCity}"   
                                        var="city"  required="true" requiredMessage="o campo cidade deve ser preenchido"
                                        itemLabel="#{city.name} #{city.states.sgl}" itemValue="#{city}" 
                                        converter="cityConverter" forceSelection="true"
                                        converterMessage="Erro, verifique a cidade" minQueryLength="3"
                                        maxResults="10" dropdown="true"> 
                        </p:autoComplete>
                    </div>
                    <div class="clear"/>
                    <p:outputLabel value="Telefone :"  styleClass="grid_3"/>
                    <p:inputMask mask="(99)9999-9999" value="#{managerCreateNotaryOffice.addres.phone}"  styleClass="grid_8"/>

                    <p:outputLabel value="Celular :"  styleClass="grid_3"/>
                    <p:inputMask mask="(99)9999-9999"  value="#{managerCreateNotaryOffice.addres.cellular}"  styleClass="grid_9"/>

                    <div class="clear"/>
                    <div class="buttonAction">
                        <p:commandButton value="Salvar"   icon="ui-icon-disk" styleClass="ui-priority-primary"
                                         actionListener="#{managerCreateNotaryOffice.save()}" update="msg" />
                        <p:commandButton value="Cancelar" icon="ui-icon-close" actionListener="#{managerRedirect.redirect('viewNotaryOffice.xhtml')}" immediate="true"/>
                    </div>
                </h:form>
            </p:panel> 


        </ui:define>
    </ui:composition>
</html>


